<?php echo $header; ?><?php echo $column_left; ?><?php echo $column_right; ?>
<div id="content"><?php echo $content_top; ?>
    <div class="breadcrumb">
        <?php foreach ($breadcrumbs as $breadcrumb) { ?>
        <?php echo $breadcrumb['separator']; ?><a href="<?php echo $breadcrumb['href']; ?>"><?php echo $breadcrumb['text']; ?></a>
        <?php } ?>
    </div>
    <div id="community">
        <div id="forum-header">
            <?php echo $community_header; ?>
        </div>
        <?php if($forum_cats){ ?>
        <?php foreach($forum_cats as $forum_cat){ ?>
        <div class="gray-box">
            <dl class="gray-box-heading">
                <dt class="gray-box-heading-first"><strong><?php echo $forum_cat['forum_name']; ?></strong></dt>
                <dd class="gray-box-heading-second"><strong><?php echo $text_topics; ?></strong></dd>
                <dd class="gray-box-heading-third"><strong><?php echo $text_posts; ?></strong></dd>
                <dd class="gray-box-heading-forth"><strong><?php echo $text_latest_post; ?></strong></dd>
            </dl>
            <?php if(isset($forums[$forum_cat['forum_id']])){ ?>
            <?php $i=0; ?>
            <?php foreach($forums[$forum_cat['forum_id']] as $forum){ ?>
            <dl class="gray-box-content <?php echo $forumStatus[$forum_cat['forum_id']][$i]; ?>" title="<?php echo $text_forum_status[$forum_cat['forum_id']][$i]; ?>">
                <dt class="gray-box-content-first">
                    <span><strong><a href="<?php echo $forum['forum_link']; ?>"><?php echo $forum['forum_name']; ?></a></strong></span>
                    <span><?php echo $forum['forum_desc']; ?></span>
                    <?php if(isset($sub_forums[$forum_cat['forum_id']][$forum['forum_id']])){ ?>
                    <span class="subforum">
                    <?php $j=0; ?>
                    <?php foreach($sub_forums[$forum_cat['forum_id']][$forum['forum_id']] as $sub_forum){ ?>
                    <a <?php echo $subforumStatus[$forum_cat['forum_id']][$forum['forum_id']][$j]; ?> href="<?php echo $sub_forum['forum_link']; ?>" title="<?php echo $text_subforum_status[$forum_cat['forum_id']][$forum['forum_id']][$j]; ?>"><?php echo $sub_forum['forum_name']; ?></a>
                    <?php $j++; ?>
                    <?php } ?>
                    </span>
                    <?php } ?>
                </dt>
                <dd class="gray-box-content-second"><?php echo $forum['forum_topics']; ?></dd>
                <dd class="gray-box-content-third"><?php echo $forum['forum_posts']; ?></dd>
                <dd class="gray-box-content-forth">
                    <?php if($forum['forum_posts']>0){ ?>
                    <?php echo $text_by; ?>&nbsp;<a href="<?php echo $forum['user_link']; ?>"><?php echo $forum['forum_last_poster_name']; ?></a><br />
                    <?php echo $forum['forum_last_post_time']; ?>
                    <?php }else{ ?>
                    <?php echo $text_never; ?>
                    <?php } ?>
                </dd>
            </dl>
            <?php $i++; ?>
            <?php } ?>
            <?php } ?>
        </div>
        <?php } ?>
        <?php } ?>
        <dl id="forum-statics">
            <dt><?php echo $text_statics; ?><span>&ndash;</span></dt>
            <dd><?php echo $text_post_total; ?><span>&ndash;</span></dd>
            <dd><?php echo $text_topic_total; ?><span>&ndash;</span></dd>
            <dd><?php echo $text_member_total; ?><span>&ndash;</span></dd>
            <dd><?php echo $text_newest_member; ?></dd>
        </dl>
        <dl id="online-status">
            <dt><?php echo $text_who_online; ?><span>&ndash;</span></dt>
            <dd><?php echo $text_online_total; ?><span>&ndash;</span></dd>
            <dd><?php echo $text_online_user; ?><span>&ndash;</span></dd>
            <dd><?php echo $text_online_guest; ?><span>&ndash;</span></dd>
            <dd><?php echo $text_online_peak; ?></dd>
        </dl>
        <?php if(false){ ?>
        <dl id="legend">
            <dt><?php echo $text_legend; ?></dt>
            <dd class="admin-icon"><?php echo $text_admin; ?></dd>
            <dd class="global-mod-icon"><?php echo $text_global_mod; ?></dd>
            <dd class="mod-icon"><?php echo $text_mod; ?></dd>
            <dd class="member-icon"><?php echo $text_member; ?></dd>
        </dl>
        <dl id="online-user-list">
            <?php foreach($online_users as $online_user){ ?>
            <dd class="<?php echo $online_user['icon_style']; ?>"><a href="<?php echo $online_user['profile_link']; ?>"><?php echo $online_user['username']; ?></a></dd>
            <?php } ?>
        </dl>
        <?php } ?>
    </div>
<?php  echo $footer; ?>
<script type="text/javascript"><!--
$(document).ready(
    function(){
        $(".gray-box-content").filter(":even").mouseover(function() {
            $(this).css("background-color", "#FFFFDB");
        }).mouseout(function(){
                $(this).css("background-color", "");
            });

        $(".gray-box-content").filter(":odd").mouseover(function() {
            $(this).css("background-color", "#FFFFDB");
        }).mouseout(function(){
                $(this).css("background-color", "");
            });
    });

$('#community input[name=\'header-keyword\']').keydown(function(e) {
    if (e.keyCode == 13) {
        $('#header-search-button').trigger('click');
    }
});

$('#header-search-button').bind('click', function() {
    url = 'index.php?route=community/search';

    var keyword = $('#forum-header-bar-search input[name=\'header-keyword\']').attr('value');

    url += '&kw=' + encodeURIComponent(keyword) + '&sw=psm&sb=lpt&or=desc&lr=all';

    location = url;
});
//--></script>
<script type="text/javascript" src="catalog/view/javascript/forum_fn.js"></script>
